<nav class="navbar navbar-expand-sm navbar-dark" style="background: #0b5196;">
    <div class="container">
        <a class="navbar-brand" href="__ROOT__/">{$site_info.site_name|default='新梅陇客栈'}</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExample07" aria-controls="navbarsExample07" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarsExample07">
            <ul class="navbar-nav mr-auto">
                <navigation nav-id="" root="" id="main-navigation" class="nav navbar-nav navbar-nav-custom" max-level="0">
                    <navigationMenu>
                        <if condition="$level gt 1">
                            <li class="menu-item-level-{$level} levelgt1">
                                <a class="nav-link" href="{$menu.href|default=''}" target="{$menu.target|default=''}">
                                    {$menu.name|default=''}
                                </a>
                            </li>
                            <else/>
                            <li class="menu-item-level-{$level}">
                                <a class="nav-link" href="{$menu.href|default=''}" target="{$menu.target|default=''}">
                                    {$menu.name|default=''}
                                </a>
                            </li>
                        </if>
                    </navigationMenu>
                    <navigationFolder root="li" class="dropdown dropdown-custom dropdown-custom-level-{$level}" dropdown="ul" dropdown-class="dropdown-menu dropdown-menu-level-{$level}">
                        <a href="#" class="nav-link dropdown-toggle dropdown-toggle-{$level}" data-toggle="dropdown">
                            {$menu.name|default=''}<span class="caret"></span>
                        </a>
                    </navigationFolder>
                </navigation>
                <!-- <li><a class="nav-link" href="{:cmf_url('resource/Topic/create')}">贡献</a></li> -->
            </ul>
            <form class="form-inline mt-2 mt-md-0" method="get"  action="{:cmf_url('portal/Search/index')}">
                <input class="form-control mr-sm-4 form-control-sm bg-light border-0" type="text" name="keyword" placeholder="搜索内容" aria-label="Search">
            </form>
            <!-- <ul class="navbar-nav navbar-right">
                <li><a class="nav-link" href="{:cmf_url('calendar/Index/index')}" class="">日历控制台</a></li>
                <li><a class="nav-link" href="#" class="">使用教程</a></li>
            </ul> -->
            <php>$user=cmf_get_current_user();</php>
            <if condition="$user eq false">
                <ul class="navbar-nav navbar-right user-nav">
                    <li><a class="nav-link" href="{:cmf_url('user/Login/index')}" class="">登录</a></li>
                </ul>
                <a class="btn btn-outline-light btn-sm ml-2" href="{:cmf_url('user/Register/index')}">注册</a>
                <else />
                <ul class="navbar-nav navbar-right user-nav">
                    <li class="nav-item dropdown header-login-user">
                        <a class="nav-link dropdown-toggle user" data-toggle="dropdown" href="#">
                            <php>$user=cmf_get_current_user();</php>
                            <if condition="empty($user['avatar'])">
                                <img src="/assets/dist/images/headicon.png" class="headicon" width="30" />
                                <else/>
                                <img src="{:cmf_get_user_avatar_url($user['avatar'])}" class="headicon" width="30" />
                            </if>
                            <span class="user-nickname"></span><b class="caret"></b>
                        </a>
                        <div class="dropdown-menu" aria-labelledby="dropdown07">
                            <a class="dropdown-item" href="{:cmf_url('user/Profile/center')}">个人中心</a>
                            <a class="dropdown-item" href="{:cmf_url('user/Favorite/index')}">我的收藏</a>
                            <a class="dropdown-item" href="{:cmf_url('user/Comment/index')}">我的评论</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="{:cmf_url('user/Profile/binding')}">安全设置</a>
                            <a class="dropdown-item" href="{:cmf_url('user/Index/logout')}">退出</a>
                        </div>
                    </li>
                </ul>
            </if>
        </div>
    </div>
</nav>